<h1><%= title%></h1>

<ul>
  <% data.forEach((item, index) => {%>
  <li class="dom"><%= item.name%></li>
  <%}) %>
</ul>

<script src="javascripts/axios.js"></script>
<script>
  console.log(axios)
  const dom = document.querySelectorAll('.dom');
  dom.forEach((item, index) => {
    item.onclick = function () {
      console.log(item, index, '---')
      axios.get('/list').then(res => {
        console.log(res, 'res')
      })
    }
  })
</script>